package xworker.swt.xworker.codeassit;

import org.xmeta.ActionContext;
import org.xmeta.Thing;
import xworker.lang.util.codeassist.CodeAssitContent;
import xworker.lang.util.codeassist.TextAssistor;
import xworker.lang.util.codeassist.textassists.CodeTypeHepler;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ActionBindTextAssistor extends CodeTypeHepler implements TextAssistor {
    List<CodeAssitContent> keyWords = new ArrayList<>();

    public ActionBindTextAssistor() {
        //SWT Events
        keyWords.add(new CodeAssitContent("Selection", "Selection", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Activate", "Activate", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Arm", "Arm", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Close", "Close", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Collapse", "Collapse", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Deactivate", "Deactivate", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("DefaultSelection", "DefaultSelection", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Deiconify", "Deiconify", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Dispose", "Dispose", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("DragDetect", "DragDetect", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("EraseItem", "EraseItem", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Expand", "Expand", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("FocusIn", "FocusIn", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("FocusOut", "FocusOut", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("HardKeyDown", "HardKeyDown", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("HardKeyUp", "HardKeyUp", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Help", "Help", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Hide", "Hide", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Iconify", "Iconify", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("KeyDown", "KeyDown", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("KeyUp", "KeyUp", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("MeasureItem", "MeasureItem", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("MenuDetect", "MenuDetect", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Modify", "Modify", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("MouseDoubleClick", "MouseDoubleClick", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("MouseDown", "MouseDown", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("MouseEnter", "MouseEnter", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("MouseExit", "MouseExit", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("MouseHover", "MouseHover", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("MouseMove", "MouseMove", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("MouseUp", "MouseUp", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("MouseWheel", "MouseWheel", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Move", "Move", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Paint", "Paint", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("PaintItem", "PaintItem", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Resize", "Resize", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("SetData", "SetData", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Show", "Show", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Traverse", "Traverse", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("Verify", "Verify", CodeAssitContent.IMAGE_NORMAL));

        //Data Listener events
        keyWords.add(new CodeAssitContent("changed", "changed", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("onReconfig", "onReconfig", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("onLoaded", "onLoaded", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("onAdded", "onAdded", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("onAddedAll", "onAddedAll", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("onRemoved", "onRemoved", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("onSeted", "onSeted", CodeAssitContent.IMAGE_NORMAL));
        keyWords.add(new CodeAssitContent("beforeLoad", "beforeLoad", CodeAssitContent.IMAGE_NORMAL));
    }

    @Override
    public List<CodeAssitContent> getContents(String textAssistor, String code, int cursorIndex, Thing thing, ActionContext actionContext) {
        if(!containsCodeType(textAssistor, "swtActionBind")){
            return Collections.emptyList();
        }

        return keyWords;
    }
}
